package com.zztl.infiniteBand.ui.activity

import com.githang.statusbar.StatusBarCompat
import com.zztl.infiniteBand.R
import com.zztl.infiniteBand.base.BaseActivity
import com.zztl.infiniteBand.storage.BillPreference
import com.zztl.infiniteBand.storage.PreferenceKeys

class WelcomeActivity : BaseActivity() {
    private val mHandler = android.os.Handler()
    private var mIsLogin: Boolean = false

    private val mRunnable = Runnable {
        if (mIsLogin) {
            skipActivity(this@WelcomeActivity, MainActivity::class.java)
        } else {
            skipActivity(this@WelcomeActivity, LoginActivity::class.java)
        }
    }

    override fun setLayoutId(): Int = R.layout.activity_welcome


    override fun initBase() {
        StatusBarCompat.setTranslucent(window, true)

        mIsLogin = BillPreference.getApp(PreferenceKeys.LOGINED.name, false) as Boolean
        mHandler.postDelayed(mRunnable, 2000)
        //        skipActivity(WelcomeActivity.this,MainActivity.class);
    }



    override fun onDestroy() {
        mHandler?.removeCallbacks(mRunnable)
        super.onDestroy()
    }
}
